import request from '@/plugins/sourcing-request'
import { sourcingRequest } from '@api/service/sourcing';
const URL_ORDERPREFIX = 'orderInquiry';
// 采购询价---客户询价
export const getCustomerInquiryListService = (data, loadingFn) => sourcingRequest({
  url: 'sourceBill/pageQueryListInquiry',
  type: 'post',
  data,
  loadingFn,
})
// 导出客户询价
export const exportCustomerInquiryListService = (data, loadingFn) => sourcingRequest({
  url: 'sourceBill/exportInquiry',
  type: 'post',
  data,
  loadingFn,
  isExport: true
})
// 订货询价---列表查询
export const getOrderInquiryListService = (data, loadingFn) => sourcingRequest({
  url: 'orderInquiry/pageQueryListOrder',
  type: 'post',
  data,
  loadingFn,
})
// 导出订货询价
export const exportOrderInquiryListService = (data, loadingFn) => sourcingRequest({
  url: 'orderInquiry/exportOrder',
  type: 'post',
  data,
  loadingFn,
  isExport: true
})
// 导出订货合同
export const exportOrderContractService = (data, loadingFn) => sourcingRequest({
  url: 'orderInquiry/exportOrderContract',
  type: 'get',
  data,
  loadingFn,
  isExport: true
})
// 采购订货 --- 生成订单列表
export const exportOrder1Service = (data) => {
  return request({
    url: `${URL_ORDERPREFIX}/exportOrder`,
    method: 'POST',
    data
  })
}
// 采购订货--- 下推页面列表
export const pushdownService = (data) => {
  return request({
    url: `${URL_ORDERPREFIX}/exportOrder`,
    method: 'POST',
    data
  })
}
// 下推页面----四级地址
export const getAddressListService = (data) => {
  return request({
    url: `/purchaseOrder/getAddressList`,
    method: 'POST',
    data
  })
}
// 下推页面----货物处理方式
export const getSysTypeInfoService = (data) => {
  return request({
    url: `/purchaseOrder/getSysTypeInfo`,
    method: 'POST',
    data
  })
}
// 下推页面----收货公司、转回公司
export const getSonCompanyListService = (data) => {
  return request({
    url: `/purchaseOrder/getDeliveryCompanyList`,
    method: 'GET',
    data
  })
}
// 下推页面-----查询开票供应商
export const queryBillSupplierService = (data) => {
  return request({
    url: `/purchaseOrder/queryBillSupplier`,
    method: 'POST',
    data
  })
}
// 中间页--定标信息列表查询-供应商维度
export const querySourcingSupplierService = (data) => {
  return request({
    url: `/sourceBill/querySourcingSupplier`,
    method: 'GET',
    data
  })
}
// 下推页面----详情信息
export const getWinSourcingSKUInforService = (data) => {
  return request({
    url: `/purchaseOrder/getWinSupplierBill`,
    method: 'GET',
    data
  })
}
// 下推页面 - 获取商品信息
export const getWinOrderInfoService = (data, loadingFn) => sourcingRequest({
  url: '/purchaseOrder/getWinSupplierBill',
  type: 'get',
  data,
  loadingFn,
})
// 下推页面 - 获取商品信息
export const getWinSkuListService = (data, loadingFn) => sourcingRequest({
  url: '/purchaseOrder/getWinSkuInfoList',
  type: 'get',
  data,
  loadingFn,
})
// 下推采购订单时校验是否需审批
export const checkPurchaseOrderPushOaService = (data) => {
  return request({
    url: `/purchaseOrder/checkPurchaseOrderPushOa`,
    method: 'get',
    data
  })
}
// 下推页面----生成下推采购订单
export const sendPurchaseOrderService = (data) => {
  return request({
    url: `/purchaseOrder/sendPurchaseOrder`,
    method: 'POST',
    data
  })
}
// 下推页面----采购订单类型
export const getSysDictByTypeService = (data) => {
  return request({
    url: `/purchaseOrder/getSysDictByType`,
    method: 'POST',
    data
  })
}
// 查看审批流
export const getOAUrlService = (data, loadingFn) => sourcingRequest({
  url: 'sourceBill/OAQueryInfor',
  type: 'GET',
  data,
  loadingFn,
})
// 重新询价
export const reinquiryService = (data, loadingFn) => sourcingRequest({
  url: 'orderInquiry/afreshInquiry',
  type: 'GET',
  data,
  loadingFn,
})
// 订货---判断单据下商品是否为待二次询价
export const checkSecondPriceService = (data) => {
  return request({
    url: `/purchaseOrder/checkSecondPriceAndSupplier`,
    method: 'POST',
    data
  })
}
// 下推采购订单 - 获取结算公司列表
export const getSettlementCompanyListService = (data) => {
  return request({
    url: `/purchaseOrder/querySettlementCompanyList`,
    method: 'POST',
    data
  })
}
// 下推采购订单 - 获取结算公司列表
export const getSettlementCompanyService = (data, loadingFn) => sourcingRequest({
  url: 'purchaseOrder/querySettlementCompanyList',
  type: 'post',
  data,
  loadingFn,
})
// 定标记录 - 报价定标记录查询
export const queryBidRecordList = (data, loadingFn) => sourcingRequest({
  url: 'sourceBill/getSourcingBillList',
  type: 'post',
  data,
  loadingFn,
})
// 导出定标记录
export const exportOrderRecordService = (data, loadingFn) => sourcingRequest({
  url: 'sourceBill/exportSourcingBillFile',
  type: 'post',
  data,
  loadingFn,
  isExport: true
})
// 订货询价-查看合同
export const queryContractInfoService = (data, loadingFn) => sourcingRequest({
  url: 'orderInquiry/getWinbiddingSupplierList',
  type: 'GET',
  data,
  loadingFn,
})
/**
 * 订货询价 - 待生成订单
 */
// 获取待生成订单列表
export const getOrderListForGeneratedService = (data, loadingFn) => sourcingRequest({
  url: 'orderInquiry/pageQueryPendingOrder',
  type: 'POST',
  data,
  loadingFn,
})
// 导出待生成订单列表
export const exportOrderListForGeneratedService = (data, loadingFn) => sourcingRequest({
  url: 'orderInquiry/exportPendingOrder',
  type: 'POST',
  data,
  loadingFn,
  isExport: true
})
// 校验是否需要签订合同
export const checkSupplierContractService = (data, loadingFn) => sourcingRequest({
  url: 'orderInquiry/checkSupplierContract',
  type: 'get',
  data,
  loadingFn,
})
// 供应商合同信息提交
export const submitContractInfoService = (data, loadingFn) => sourcingRequest({
  url: 'orderInquiry/saveSignContractInfo',
  type: 'POST',
  data,
  loadingFn,
})
// 获取收货公司地址
export const getCompanyAddressService = (data, loadingFn) => sourcingRequest({
  url: 'purchaseOrder/getCompanyAddress',
  type: 'get',
  data,
  loadingFn,
})
// 订货询价-待生成订单-重新询价
export const reinquiryForGenerateOrderService = (data, loadingFn) => sourcingRequest({
  url: 'orderInquiry/pendingAfreshInquiry',
  type: 'get',
  data,
  loadingFn,
})
